import type { PostPatientConsultOrderParams } from '@/types/consult'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useConsultStore = defineStore(
  'consult',
  () => {
    const initalValue = {
      illnessDesc: '',
      illnessTime: 2,
      consultFlag: 1,
      pictures: [],
    }
    const illnessInfo1 = ref<
      Pick<
        PostPatientConsultOrderParams,
        'illnessDesc' | 'illnessTime' | 'consultFlag' | 'pictures'
      >
    >({
      ...initalValue,
    })
    // 问诊类型，医院类型，科室id
    const type = ref('')
    const illnessType = ref('')
    const depId = ref('')
    const patientId = ref('')
    const reset = () => {
      illnessInfo1.value = { ...initalValue }
      type.value = ''
      illnessType.value = ''
      depId.value = ''
      patientId.value = ''
    }
    return { illnessInfo1, type, illnessType, depId, patientId, reset }
  },
  { persist: true }
)
